/* Replication for Tago and Ikeda BJPS article*/

gen democracy = 1
replace democracy = 0 if pat>=9
label define label_democracy 0"Pirate" 1"Democracy"
label values democracy label_democracy
gen participation20 = 1
for num 5/8: replace participation20 = 0 if pat==X
for num 13/16: replace participation20 = 0 if pat==X
label define label_participation20 0"3 countries" 1"20 countries"
label values participation20 label_participation20
gen result=0
replace result=1 if pat==1 | pat==5 | pat==9 | pat==13
replace result=2 if pat==2 | pat==6 | pat==10 | pat==14
replace result=3 if pat==3 | pat==7 | pat==11 | pat==15
replace result=4 if pat==4 | pat==8 | pat==12 | pat==16
label define label_result 1"#1 Unanimous UNSC Approval" 2"#2 Narrow UNSC Approval" 3"#3 Vetoed by Russia and China" 4"#4 Draft Res. Withdrawn"
label values result label_result
gen approve=0
replace approve=1 if pat==1 | pat==5 | pat==9 | pat==13
gen part_approve=0
replace part_approve=1 if pat==2 | pat==6 | pat==10 | pat==14
gen disapprove=0
replace disapprove=1 if pat==3 | pat==7 | pat==11 | pat==15
gen withdraw=0
replace withdraw=1 if pat==4 | pat==8 | pat==12 | pat==16
for num 1/2: recode q0X 5=.
for num 1/2: recode q0X 6=.
for num 1/5: recode q06_X 5=.
for num 1/5: recode q06_X 6=.
for num 7/9: recode q0X 5=.
for num 7/9: recode q0X 6=.
recode q10 5=.
recode q10 6=.
for num 1/6: recode q11_X 5=.
for num 1/6: recode q11_X 6=.
for num 13/14: recode qX 5=.
for num 13/14: recode qX 6=.
recode q17 11=.
recode q17 12=.
recode q20 5=.
recode q20 6=.
recode q21 6=.
recode q21 7=.
gen interest = 5-q01
gen authority_UN = 5-q07
gen force_use = 5-q02
gen love_US = 5-q08
gen liberal = 10-q17
gen trust_Japan = 5-q06_1
gen trust_US = 5-q06_2
gen trust_Russia = 5-q06_3
gen trust_China = 5-q06_4
gen trust_UN = 5-q06_5
gen knowledge1 = 0
replace knowledge1=1 if q03==4
gen knowledge2 = 0
replace knowledge2=1 if q04==1
gen knowledge3 = 0
replace knowledge3=1 if q05==4
for num 1/3: label define knowledgeX 0"Incorrect" 1"Correct"
gen knowledge_total = knowledge1 + knowledge2 + knowledge3
gen support_US = 5-q09
gen support_SDF = 5-q10
gen free_ride = support_US - support_SDF
gen int_desirable = 5-q11_1
gen Japan_desirable = 5-q11_2
gen legitimacy_intention = 5-q11_3
gen legitimacy_process = 5-q11_4
gen legitimacy_law = 5-q11_6
gen last_method = 5-q11_5
gen benefit = q12
label define label_benefit 1"US" 2"International" 3"Country_A" 4"ME" 5"Else" 6"DK" 7"NA"
label values benefit label_benefit
gen influence_good = 5-q13
gen influence_bad = 5-q14
gen male = 0
replace male = 1 if q18==2
gen age = 2012 - q19
gen university = 0
replace university = 1 if q20==4
gen income = 6-q21
for num 1/16: tab benefit if pat==X
for num 1/4: tab benefit if democracy==1 & result==X
for num 1/4: tab benefit if democracy==0 & result==X
for num 1/4: tab benefit if participation20==0 & result==X
for num 1/4: tab benefit if participation20==1 & result==X
tab benefit result, col
drop if participation20==1
sort  democracy 

/* Table IIa and IIb, Figure I and II (4=Approve, 3=Somewhat approve, 2=Somewhat disapprove, 1=Disapprove) */
by democ: tab result support_US, row
by democ: oneway support_US result, tabulate
by democ: oneway support_US result, scheffe
/* Table IIIa and IIIb, Figure III and VI (4=Approve, 3=Somewhat approve, 2=Somewhat disapprove, 1=Disapprove)*/
by democ: tab result support_SDF, row
by democ: oneway support_SDF result, tabulate
by democ: oneway support_SDF result, scheffe
/* Web Appendix*/
by democ: oneway int_desirable result, tabulate
by democ: oneway int_desirable result, scheffe
by democ: oneway Japan_desirable result, tabulate
by democ: oneway Japan_desirable result, scheffe
by democ: oneway last_method result, tabulate
by democ: oneway last_method result, scheffe
by democ: oneway legitimacy_intention result, tabulate
by democ: oneway legitimacy_intention result, scheffe
by democ: oneway legitimacy_process result, tabulate
by democ: oneway legitimacy_process result, scheffe
by democ: oneway legitimacy_law result, tabulate
by democ: oneway legitimacy_law result, scheffe
